package io.renren.modules.student.controller;

import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;
import io.renren.modules.student.service.StuCourseManageService;
import io.renren.modules.sys.controller.AbstractController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/stu/courseManage")
public class StuCourseManageController extends AbstractController {
    @Autowired
    private StuCourseManageService stuCourseManageService;
    /*
    获得课程表列表
     */
    @GetMapping("/list")
    public R list(@RequestParam Map<String, Object> param){
        param.put("userId",getUserId()+"");
        PageUtils result = stuCourseManageService.queryList(param);
        return R.ok().put("page",result);
    }
    /*
    删除课程
    */
    @PostMapping("/deleteCourse")
    public R deleteCourse(@RequestBody Map<String, Object> param) {
        param.put("userId",getUserId()+"");
        stuCourseManageService.deleteCourse(param);
        return R.ok();
    }
}
